home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
countdn.zip
/
COUNTDN.C
next >
Wrap
Text File
|
1988-10-24
|
1KB
|
69 lines
/*
COUNTDOWN Ver 1.0 This Program is PUBLIC DOMAIN
Author: Kirby Angell Do with it what you will
Date : Oct 88
Commets to the author may be addressed to:
via NetMail address 147/42
BBS Number (405)771-5954
Or by snail at
12500 Teakwood Rd
Edmond, OK 73013
*/
#define LIMIT 30
#define OK 0
#define ERROR 1
#include <stdlib.h>
logo()
{
printf("\nCOUNTDOWN ver 1.0\n");
}
argcheck(int count, char *param)
{
if (count < 2) {
printf("\nUSAGE: COUNTDN 1 50\n");
printf("Would exit with errorlevel 1 if you press a key before the program ends,\n");
printf("or exit in 50 seconds with errorlevel %d if you don't.\n",OK);
exit(ERROR);
}
if ((atoi(param) == OK) || (atoi(param) == ERROR)) {
printf("\nERROR: Errorlevel cannot equal %d or %d\n",OK,ERROR);
exit(ERROR);
}
}
main(int argc, char *argv[])
{
int timer;
int errorlevel;
int top;
logo();
argcheck(argc,argv[1]);
errorlevel = atoi(argv[1]);
if (argc == 3)
top = atoi(argv[2]);
else
top = LIMIT;
printf("Press Any Key to exit with given errorlevel...\n");
for (timer = top;timer > 0; --timer) {
printf(".");
delay(1000);
if (kbhit())
{
getch();
printf("\n");
exit(errorlevel);
}
}
printf("\n");
return OK;
}